﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace QLNHASACH.PresentationLayer.SearchCtrl
{
    public partial class ItemKH : UserControl
    {
        public ItemKH()
        {
            InitializeComponent();
            lbHoten.GotFocus += new EventHandler(lbHoten_GotFocus);
            lbHoten.LostFocus += new EventHandler(lbHoten_LostFocus);
        }
        #region Thuộc tính
        public string Hoten
        {
            get
            {
                return lbHoten.Text;
            }
            set
            {
                lbHoten.Text = value;
            }
        }
        public string SDT
        {
            get
            {
                return lbSDT.Text;
            }
            set
            {
                lbSDT.Text = value;
            }
        }
        public string DiaChi
        {
            get
            {
                return lbDiaChi.Text;
            }
            set
            {
                lbDiaChi.Text = value;
            }
        }
        public string Email
        {
            get
            {
                return lbEmail.Text;
            }
            set
            {
                lbEmail.Text = value;
            }
        }

        #endregion
        public delegate void sukien(Object sender);
        public event sukien Clik;

        void lbHoten_LostFocus(object sender, EventArgs e)
        {
            this.BackColor = SystemColors.GradientInactiveCaption;
        }

        void lbHoten_GotFocus(object sender, EventArgs e)
        {
            this.BackColor = Color.GreenYellow;

        }
        public void SetData(DataRow row)
        {
            Hoten = row[1].ToString();  
            DiaChi = row[2].ToString();
            Email = row[3].ToString();
            SDT = row[4].ToString();
        }

        private void lbEmail_MouseEnter(object sender, EventArgs e)
        {
            lbHoten.Focus();
        }

        private void lbHoten_Click(object sender, EventArgs e)
        {
            if (Clik != null)
                Clik(this);
        }
    }
}
